package cn.chmcyz.bootredis.controller;


import cn.chmcyz.bootredis.common.Result;
import cn.chmcyz.bootredis.model.Employee;
import cn.chmcyz.bootredis.service.IEmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chm
 * @since 2020-12-20
 */
@RestController
@RequestMapping("/employee")
public class EmployeeController {
    @Autowired
    private IEmployeeService employeeService;

    @GetMapping("findById/{id}")
    public Object findById(@PathVariable("id") Integer id) {
        return employeeService.selectById(id);
    }

    @GetMapping("insert")
    public Object findById() {
        Employee employee = employeeService.getById(7000);
        employee.setId(1);
        return Result.sucess(null);
    }
}
